package com.ls.fw.data.search.impl.dao.base;

import java.util.Map;

import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.response.UpdateResponse;


/**
 * 
 * 注:
 *   若本接口的方法不能满足您的需求，可调用getServer方法操作底层方法
 * @see HttpSolrServer
 * @author defender
 *
 */
public interface BaseSolrDao {

	/**
	 * 唯一键
	 */
	public static final String DEFAULT_PK = "id";
	
	
	public UpdateResponse add(Map<String, Object> data) ;
	
	public UpdateResponse add(Object model) ;
	
	public UpdateResponse save(Object model) ;
	
	/**
	 * 
	 * @param baseUrl
	 * @param name
	 * @return
	 */
	public SolrServer buildSolrServer(String baseUrlOrzkHost, String name);
	
	
	/**
	 * 
	 * @param baseUrl
	 * @param name
	 * @return
	 */
	public SolrServer newSolrServer(String baseUrlOrzkHost, String name);
	
	
	/**
	 * 改变collection
	 * @param name
	 */
	public SolrServer switchName(String name);
	
	
	/**
	 * 改变solr服务地址
	 * @param baseUrl
	 * @param name collection名称
	 * @return
	 */
	public SolrServer switchServer(String baseUrlOrzkHost,String name);
	
	
	/**
	 * 改变solr服务地址
	 * @param baseUrl
	 * @return
	 */
	public SolrServer switchServer(String baseUrlOrzkHost);
	
	public void commit() ;
	
	public void rollback() ;
	
	public SolrServer open();
	
	public SolrServer reopen();
	
	public void close() ;
	
	public SolrServer getServer();
	
	public String getBaseURL();
	 
	public String getName();
	
	public boolean isAutoCommit();
	
	public boolean isCloud();
	
}
